
$(document).ready(function() {
	var acOptions = {
		    minChars: 0,
		    max: 5,
		    dataType: 'json', // this parameter is currently unused
		    parse: function(data) {
		        var parsed = [];		 
		        for (var i = 0; i < data.length; i++) {
		            parsed[parsed.length] = {
		                data: data[i],
		                value: data[i].id,
		                result: data[i].title
		            };
		        }		 
		        return parsed;
		    },
		    formatItem: function(item) {
		        return item.title;
		    }
		};
	
	$("#searchbook").autocomplete('http://localhost/bluub/json/book',acOptions).result(function(event, item) {
		  alert(item.id);
	});
});
